cmake_minimum_required(VERSION 3.12)
project(device)

file(GLOB ${PROJECT_NAME}_SOURCES
    "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp"
)

add_compile_options(-g)

add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_SOURCES})

if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "aarch64")
    target_link_directories(${PROJECT_NAME} PUBLIC
        /opt/MVS/lib/aarch64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/d2c/lib/arm-64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/OpenNI2/arm/Arm64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/UvcSwapper/arm-64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../data/lib/arm/
    )
else()
    target_link_directories(${PROJECT_NAME} PUBLIC
        /opt/MVS/lib/64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/d2c/lib/x64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/OpenNI2/linux/x64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/UvcSwapper/x64/
        ${CMAKE_CURRENT_SOURCE_DIR}/../../data/lib/x64/
    )
endif()

target_link_libraries(${PROJECT_NAME} PUBLIC
    ${OpenCV_LIBS}
    MvCameraControl
    Threads::Threads
    spdlog::spdlog
    component
    web-service
    usbp-1
    sl_lidar_sdk
    OpenNI2
    d2c
    nmea
)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/rplidar/sdk/include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/d2c/Include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/OpenNI2/Include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/UvcSwapper/Include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/nmea/include/nmea
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/nmea/include/
)

target_include_directories(${PROJECT_NAME} PUBLIC
    /opt/MVS/include
    ${CMAKE_CURRENT_SOURCE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/../component/
    ${CMAKE_CURRENT_SOURCE_DIR}/../webservice/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/rplidar/sdk/include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/rplidar/sdk/src/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/d2c/Include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/OpenNI2/Include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/third_party/UvcSwapper/Include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/orbbec/Include/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/nmea/include/nmea/
    ${CMAKE_CURRENT_SOURCE_DIR}/../../third_party/nmea/include/
)

add_dependencies(${PROJECT_NAME}
    component
    web-service
)
